package com.ly.mapper;

import com.ly.bean.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
@author 李岩
@date 2021/12/14-13:52
@describe
*/
@Mapper
public interface AdminMapper {
    /**
     * delete by primary key
     * @param aId primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer aId) throws Exception;

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(Admin record) throws Exception;

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(Admin record) throws Exception;

    /**
     * select by primary key
     * @param aId primary key
     * @return object by primary key
     */
    Admin selectByPrimaryKey(Integer aId) throws Exception;

    //查询所有的管理员信息
    List<Admin> selectAllAdmin() throws Exception;

    /*根据用户名获取admin对象*/
    Admin selectAdminByaName(String aName) throws Exception;

    //删除用户角色
    void deleteRoleByaId(Integer aId) throws Exception;

    //添加用户的角色
    void addRolesAdmins(@Param("roleId") Integer roleId, @Param("aId") Integer aId) throws Exception;

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Admin record) throws Exception;

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Admin record) throws Exception;
}